import {useState} from 'react'
function App() {
  // 响应式简单数据
  const [count,setCount] = useState(0);
  // 响应式复杂数据
  const [form, setForm] = useState({name:'john'})
  const handleClick = () =>{
    // 必须使用setCount方法才能实现视图更新
    setCount(count + 1)
  }
  const handleClick1= () =>{
    // 必须使用setCount方法才能实现视图更新
    setForm({
      ...form,
      name: 'jack'
    })
  }
  return (
    <div className="App">
      <button onClick={handleClick}>{count}</button>
      <button onClick={handleClick1}>修改{form.name}</button>
    </div>
  )
}

export default App;
